package com.eyuai.netlibrary.utils;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import com.eyuai.netlibrary.RxHttpUtils;

/**
 * Created by allen on 2016/12/23.
 * <p>
 * 关于应用的工具类
 */

public class AppUtils {

    /**
     * 获取手机版本号
     *
     * @return 返回版本号
     */
    public static String getAppVersion() {
        PackageInfo pi;
        String versionNum;
        try {
            PackageManager pm = RxHttpUtils.getContext().getPackageManager();
            pi = pm.getPackageInfo(RxHttpUtils.getContext().getPackageName(), PackageManager.GET_CONFIGURATIONS);
            versionNum = pi.versionName;
        } catch (Exception e) {
            versionNum = "0";
        }
        return versionNum;
    }


}
